package com.zmj.sy.mom.srv.aps.shcedule;

import com.zmj.sy.mom.srv.aps.bean.vo.dayworkorder.ApsDayOrderCheckAddReqVo;
import com.zmj.sy.mom.srv.aps.service.ApsDayOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Slf4j
@Component
@RequiredArgsConstructor
public class DayPlanCheckJob {

    private final ApsDayOrderService apsDayOrderService;

    @Scheduled(cron = "0 5 7 * * ?")
    public void dayPlanCheck() {

        ApsDayOrderCheckAddReqVo reqVo = new ApsDayOrderCheckAddReqVo();
        reqVo.setDay(LocalDate.now().minusDays(1));

        // 全部对比
        apsDayOrderService.checkAdd(reqVo);

        // 自动处理相关的工作组
        apsDayOrderService.autoCheck(reqVo.getDay());

    }

}
